package com.bit.strongbaby;
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class BoardAdapter extends BaseAdapter {
	private Context mContext;
	private int mLayout;
	private ArrayList<BoardDTO> mItems;
	private LayoutInflater mInflater;
	
	public BoardAdapter(Context mContext, int mLayout,
			ArrayList<BoardDTO> mItems) {
		this.mContext = mContext;
		this.mLayout = mLayout;
		this.mItems = mItems;
		this.mInflater = (LayoutInflater)mContext.getSystemService(mContext.LAYOUT_INFLATER_SERVICE);
		
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mItems.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView == null){
			convertView = mInflater.inflate(mLayout, parent,false);
		}
		TextView txt1 = (TextView)convertView.findViewById(R.id.textView1);
		TextView txt2 = (TextView)convertView.findViewById(R.id.textView2);
		TextView txt3 = (TextView)convertView.findViewById(R.id.textView3);
		TextView txt4 = (TextView)convertView.findViewById(R.id.textView4);
		
		txt1.setText(mItems.get(position).getId());
		txt2.setText(mItems.get(position).getTitle());
		txt3.setText(mItems.get(position).getDate());
		txt4.setText(mItems.get(position).getContent());
		
		return convertView;
		
		
	}

}
